package com.kingmed.kmss.api.standard.admin;

import com.kingmed.kmss.common.annotation.IgnoreCommonResponseAdvice;
import com.kingmed.kmss.common.dto.api.resp.admin.TokenAuthUserVo;
import com.kingmed.kmss.common.vo.api.ApiCommonResponse;
import com.kingmed.kmss.common.vo.api.ApiCommonResponseHelper;
import com.kingmed.kmss.framework.feign.client.auth.CommonAuthFeignFacade;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 对外围系统提供的标准接口
 * 强制：只能调用framework-feign里的client，不允许添加任何业务逻辑，业务逻辑必须写在facade
 * </p>
 */
@RestController
@RequestMapping("/service/admin/v1.0")
@Api(tags = "系统管理-对外标准接口")
@IgnoreCommonResponseAdvice
public class AuthApiController {

    @Autowired
    private CommonAuthFeignFacade authFeignFacade;

    /**
     * 校验token是否生效
     */
    @ApiOperation(value = "校验token是否生效")
    @GetMapping(value = "/checkToken")
    public ApiCommonResponse<TokenAuthUserVo> checkToken(@RequestParam String token) {
        return ApiCommonResponseHelper.success(authFeignFacade.checkToken(token));
    }

}
